package com.objcat.playground.leetcode.top100.two_number;

import java.util.Arrays;

public class Solution {

    public static void main(String[] args) {
        int[] result = new Solution().twoSum(new int[]{2, 7, 11, 15}, 17);
//        Arrays.stream(result).forEach(System.out::println);
        System.out.println(Arrays.toString(result));
    }

    public int[] twoSum2(int[] nums, int target) {
        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i] + nums[i + 1] == target) {
                return new int[] {i, i + 1};
            }
        }
        return new int[] {};
    }

    public int[] twoSum(int[] nums, int target) {
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length - i - 1; j++) {
                System.out.println(j);
                System.out.println(j + 1);
            }
        }
        return new int[] {};
    }
}
